<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text">

    <script>
        var input = document.querySelector('input');
        // 手机号正则
        let reg = /^1[3-9]\d{9}$/g;

        input.oninput = function (e) {
            reg.lastIndex = 0; // 重置正则的索引
            // 获取输入的内容
            let value = e.target.value;
            // 判断是否符合手机号正则
            if (reg.test(value)) {
                // 符合正则
                console.log('符合');
            } else {
                // 不符合正则
                console.log('不符合');
            }
        }
    </script>
</body>

</html>